package com.blb.exam.student.dao.impl;

import com.blb.exam.common.entity.QuetionSet;
import com.blb.exam.common.util.DBUtils;
import com.blb.exam.student.dao.QuetionSetDAO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public class QuetionSetDAOImpl implements QuetionSetDAO {

    @Override
    public List<QuetionSet> selectAll() {
        return DBUtils.executeQuery(QuetionSet.class,"select * from t_quetion_set");
    }

    @Override
    public QuetionSet selectById(Integer id) {
        List<QuetionSet> quetionSets = DBUtils.executeQuery(QuetionSet.class, "select * from t_quetion_set where id = ?", id);
        if(quetionSets != null && !quetionSets.isEmpty()){
            return quetionSets.get(0);
        }
        return null;
    }
}
